Skip to content

feat: generated fastapi boilerplate with versioning and with folder s…#1

Open
Jhanvi-vc wants to merge 6 commits intodevelopmentfrom
feature/fastapi
Open

feat: generated fastapi boilerplate with versioning and with folder s…#1
Jhanvi-vc wants to merge 6 commits intodevelopmentfrom
feature/fastapi

Conversation

@Jhanvi-vc
Copy link

…tructure.

Copy link
Collaborator

@abhi02-vc abhi02-vc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asgi.py

Risk Score: 2/5

Import order

Python imports are generally organized in a specific order. First, standard library imports, then related third-party imports, and finally local application/library specific imports. Current order seems to follow this but should be explicitly stated for clarity.

Hardcoded reload flag

The reload=True flag in uvicorn.run is useful during development but should be set to False in production environments to avoid unnecessary reloads.

Environment variable usage

The environment variables SERVER_HOST and SERVER_PORT should have default values in case they are not set in the environment. This can prevent the application from failing in such cases.

config/env_config.py

Risk Score: 3/5

Missing environment variable validation

The current implementation does not validate if the required environment variables are set. This can lead to runtime errors if a variable is missing.

dotenv configuration

The use of join to create the dotenv_path is generally fine, but it's worth noting that os.path.join is more explicit and recommended than join in Python.

Environment variable security

While environment variables are a good way to handle sensitive data, it's still important to ensure that the .env file is not committed to version control systems like Git. Consider using a .gitignore file to exclude this file.

config/database.py

Risk Score: 2/5

Database URL construction

Using f-strings to construct the database URL is generally safe, but ensure that the environment variables are sanitized to prevent SQL injection vulnerabilities.

SessionLocal and Base definition

The placement of SessionLocal and Base definitions at the module level is good practice for ensuring they are available throughout the application. However, consider wrapping them in a function if they are expensive to create.

Database pool configuration

The pool settings (pool_recycle and pool_pre_ping) are appropriate for a production environment. However, ensure that these values are tuned based on the specific requirements of your application.

utils/password_utils.py

Risk Score: 1/5

Password hashing scheme

Using bcrypt for password hashing is a good choice. Ensure that the CryptContext is configured with the latest recommendations for security.

Class structure

The PasswordUtils class could be further refactored to include methods for password verification (verify_password) and password generation (generate_password). This would make the class more modular and easier to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants